﻿/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package task_5;

import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author Гамзатов
 */
    enum Daylight {Morning, Noon, Evening, Night} // время суток
    enum Luminary {IsShiny, IsntShiny} // солнечно/пасмурно
    enum Baby {Puppy, Kitten, Hedgehog, Bearcub, Piglet, Bat, Ballon} // детеныши 
    enum delivery {Demon, Stork, Error}
public class Cloud {
    public
    Daylight dl; // задается польз-лем
    Luminary lm; // задается польз-лем
    int win_val; // значение ветра, заданное польз-лем, от 0 до 10
    Baby baby = Baby.Ballon;
    
    private Baby InternalCreate() // создает детеныша
    {
       
        if(((win_val<=3)&&(win_val>=1))&&(lm==Luminary.IsShiny)&&(dl==Daylight.Morning))
                baby = Baby.Puppy;
       
        if(((win_val<=10)&&(win_val>=9))&&(lm==Luminary.IsShiny)&&(dl==Daylight.Noon))
                baby = Baby.Ballon;
        
        if(((win_val<=8)&&(win_val>=7))&&(lm==Luminary.IsntShiny)&&((dl==Daylight.Evening)||(dl==Daylight.Night)))
                baby = Baby.Bat;
        
        if(((win_val<=6)&&(win_val>=4))&&(lm==Luminary.IsShiny)&&(dl==Daylight.Noon))
                baby = Baby.Bearcub;
        
        if(((win_val<=8)&&(win_val>=6))&&(lm==Luminary.IsShiny)&&(dl==Daylight.Evening))
                baby = Baby.Hedgehog;
        
        if(((win_val<=6)&&(win_val>=5))&&(lm==Luminary.IsntShiny)&&((dl==Daylight.Night)||(dl==Daylight.Morning)))
                baby = Baby.Kitten;
        
        if(((win_val<=4)&&(win_val>=2))&&(lm==Luminary.IsntShiny)&&(dl==Daylight.Morning))
                baby = Baby.Piglet;
        return baby;
    }
    
    public delivery Create()
    {
        System.err.println("Write down the wind power");
        Scanner in = new Scanner(System.in);
        //Считывание строки до пробела из потока
        win_val = in.nextInt(); 
        if((win_val>=1)&&(win_val<=10))
        {
            baby = InternalCreate();
            Magic mag = new Magic();
        
            if((baby==Baby.Hedgehog)||(baby==Baby.Bearcub)||(baby==Baby.Bat))
                return mag.CallDemon();
            if((baby==Baby.Ballon)||(baby==Baby.Kitten)||(baby==Baby.Puppy)||(baby==Baby.Piglet))
                return mag.CallStork();
        }
        else System.out.println("\nWrong value for wind.\nRecall the Create function");
        return delivery.Error;
    }
    
}

